<template>
  <h1 v-show="sum">当前求和结果{{ sum }}</h1>
  <br />
  <button @click="sum++">sum+1</button>
  <hr />
  <h1 v-show="msg">当前信息：{{ msg }}</h1>
  <br />
  <button @click="msg += '@'">信息修改</button>
  <hr />
</template>

<script>
import { ref, watchEffect } from "vue";
export default {
  name: "Demo",
  setup() {
    // 数据
    let sum = ref(0);
    let msg = ref("你好啊");

    // 
    watchEffect(()=>{
      let x = sum.value
      let y = msg.value
      console.log(x, y);
    })

    // 返回一个对象（常用）
    return {
      sum,
      msg,
    };
  },
};
</script>

<style>
</style>
